<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib prefix="rapid" uri="http://www.rapid-framework.org.cn/rapid" %>
<rapid:override name="title">
    -帖子列表
</rapid:override>
<rapid:override name="header-style">
</rapid:override>

<rapid:override name="content">
    <blockquote class="layui-elem-quote">
        <span class="layui-breadcrumb" lay-separator="/">
          <a href="/backIndex/homepage">首页</a>
          <a>我的帖子</a>
          <a>帖子列表</a>
        </span>
    </blockquote>
    <%--    <form class="layui-form" align="right" action="/post/search">--%>
    <%--        <div class="layui-input-block">--%>
    <%--            <input type="hidden" name="userId" value=${user.userId}>--%>
    <%--            <input type="text" name="search" required autocomplete="off" class="layui-input">--%>
    <%--            <button class="layui-btn">搜索</button>--%>
    <%--        </div>--%>
    <%--    </form>--%>

    <form class="layui-form" align="right" action="/post/search">
        <div class="layui-form-item">
            <div class="layui-inline">
                <div class="layui-input-inline" style="width:500px;margin-right:-1px">
                    <input type="text" name="search" required autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline" style="width:64px;margin:0px">
                    <button class="layui-btn">搜索</button>
                </div>
            </div>
        </div>
    </form>


    <div class="layui-tab layui-tab-card">
        <form id="articleForm" method="post">
            <input type="hidden" name="currentUrl" id="currentUrl" value="">
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                    <col width="240">
                    <col width="70">
                    <col width="70">
                    <col width="70">
                    <col width="100">
                    <col width="50">
                    <col width="50">
                </colgroup>
                <thead>
                <tr>
                    <th>分类</th>
                    <th>标题</th>
                    <th>浏览量</th>
                    <th>回复量</th>
                    <th>点赞量</th>
                    <th>最后更新时间</th>
                    <th>帖子状态</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${pageInfo.list}" var="a">
                    <tr>
                        <td>
                                ${a.cat.categoryName}
                        </td>
                        <td>
                            <a href="/post/${a.postId}"
                               target="_blank">
                                    ${a.title}
                            </a></td>
                        <td>
                                ${a.postViewCount}
                        </td>
                        <td>
                                ${a.commentCount}
                        </td>
                        <td>
                                ${a.likeCount}
                        </td>
                        <td>
                            <fmt:formatDate value="${a.updateTime}"
                                            pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${a.postStatus == 1}">
                                    正常
                                </c:when>
                                <c:otherwise>
                                    <span style="color:#FF5722;">已删除</span>
                                </c:otherwise>
                            </c:choose>
                        </td>
                        <td align="center">
                            <a href="/post/deletePost/${a.postId}"
                               onclick="return confirmDelete()"
                               class="layui-btn layui-btn-danger layui-btn-mini">删除</a></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </form>
        <%@ include file="../Public/paging.jsp" %>
    </div>

</rapid:override>
<rapid:override name="footer-script">
    <script></script>
</rapid:override>
<%@ include file="../Public/framework.jsp" %>
